<?php

namespace app\model\questionnaire;

use app\BaseModel;
use app\model\UserModel;
use think\model\relation\BelongsTo;

/**
 * 问卷系统-问卷任务用户结果
 */
class QuestionnaireTaskUserResultModel extends BaseModel
{
    protected $name = 'questionnaire_task_user_result';

    /**
     * 发布人
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(UserModel::class,'uid')->bind([
            'user_name' => 'name',
            'user_avatar' => 'avatar',
            'phone',
            'age',
            'sex',
            'username',
            'user_number',
            'student_status',
            'role_name',
            'department_id',
            'departmentAdmins'
        ]);
    }

    /**
     * 试卷
     * @return BelongsTo
     */
    public function paper(): BelongsTo
    {
        return $this->belongsTo(QuestionnairePaperModel::class,'paper_id')->bind([
            'paper_name' => 'name',
            'paper_type_name' => 'type_name',
            'paper_total_score' => 'total_score',
            'paper_topic_num' => 'topic_num',
            'paper_time_limited' => 'time_limited',
            'paperTopic'
        ]);
    }
}